<?php
/**
 * Created by PhpStorm.
 * User: zjw
 * Date: 2018/5/22
 * Time: 下午2:24
 */

namespace api\modules\v1\controllers;

use common\service\ServiceFactory;

class ActivityController extends RestController
{
    public $modelClass = "common\models\Activity";

    public function actionCurrentActivity($symbol)
    {
        $activityService = ServiceFactory::getInstance()->getActivityService();
        $currentActivity = $activityService->getCurrentActivity($symbol);
        if ($currentActivity == null) {
            return ['code' => 0, 'message' => '当前没有开放的活动'];
        }
        return ['code' => 1, 'data' => $currentActivity];
    }
}
